package com.gang.service;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author maj
 * @ClassName ThreadPoolFactory
 * @Description
 * @date 2020-08-30 16:57
 */
public class ThreadPoolFactory {

  private static  ThreadPoolExecutor pool=null;

  public static  ThreadPoolExecutor getThreadPoolExecutor(){

    if(pool==null){
      pool = new ThreadPoolExecutor(5, 6, 3,
          TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(3)
      );
    }

    return pool;

  }

}
